<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<link rel="icon" href="../img/system/icon/Exchange-logo.jpg" type="image/x-icon">
		<title>易置-物品分类页</title>
		<link rel="stylesheet" type="text/css" href="../css/goods_all.css"/>
	</head>
	<body>
		<div class="wrapper">
			<!--顶两侧到头-->
			<div class="inside">
				<!--顶部-->
				<div class="header">
					<span id="address">当前位置：首页推荐信息，注册登录后获取更多定位信息
						<!--<form action="" method="post">
							<input type="text" name="school_address" id="school_address" value="" />
							<input type="submit" id="school_address_submit" value="&nbsp;确定&nbsp;"/> 
						</form>-->
					</span>
					<ul>
						<li>您好，请</li>
						<li><a href="login.html">登录</a></li>
						<li><a href="login.html">免费注册</a>&nbsp;&nbsp;|</li>
						<li><a href="login.html">消息</a></li>
					</ul>
				</div>
			</div>
			<div class="inside02">
				<!--logo-->
				<div class="header_logo">
					<a href="../index.html"><img class="logo" src="../img/system/icon/Exchange-logo.jpg" /></a>
					<span>易置</span>
					<form action="goods_all_search.php" method="post">
						<input type="text" name="goods_name" id="search_header" />
						<input class="search" type="submit" name="submit" value="搜索"/>
					</form>
				</div>
				<!--导航栏-->
				<div class="nav">
					<!--<a href="#fenlei">-->
					<div class="nav_first">
						<a href="#"><span>物品分类</span></a>
					</div>
					<!--</a>-->
					<ul>
						<li class="home"><a href="#" onClick="javascript :history.back(-1);">首页</a></li>
					</ul>
				</div>
			</div>
			<br /><br />
			<div class="inside04">
				<div class="goods">
<?php
//$goods_name=$_POST['goods_name'];	
//分页的函数
function news($pageNum = 1, $pageSize = 3)
{
	$goods_name=$_POST['goods_name'];	
$array = array();
$coon = mysqli_connect("localhost", "root","123456");
mysqli_select_db($coon, "db_exchange");
mysqli_query($coon,"set names 'utf8'");
// limit为约束显示多少条信息，后面有两个参数，第一个为从第几个开始，第二个为长度
$rs = "select * from tb_goods WHERE goods_name LIKE '%".$goods_name."%' limit " . (($pageNum - 1) * $pageSize) . "," . $pageSize;
$r = mysqli_query($coon, $rs);
while ($obj = mysqli_fetch_object($r)) {
$array[] = $obj;
}
mysqli_close($coon,"db_exchange");
return $array;
}

//显示总页数的函数
function allNews()
{
$coon = mysqli_connect("localhost", "root","123456");
mysqli_select_db($coon, "db_exchange");
mysqli_query($coon,"set names 'utf8'");
$rs = "select count(*) num from tb_goods"; //可以显示出总页数
$r = mysqli_query($coon, $rs);
$obj = mysqli_fetch_object($r);
mysqli_close($coon,"db_exchange");
return $obj->num;
}

@$allNum = allNews();
@$pageSize = 10; //约定每页显示几条信息
@$pageNum = empty($_GET["pageNum"])?1:$_GET["pageNum"];
@$endPage = ceil($allNum/$pageSize); //总页数
@$array = news($pageNum,$pageSize);
?>
					<?php
						foreach($array as $key=>$values){
							$goods_id=$values->goods_id;
							$img_pathi=$values->img_path;
							$goods_namei=$values->goods_name;
							$goods_moneyi=$values->goods_money;
					?>		
					<div class="good01">
						<!--物品简项表单提交部分-->
						<form action="goods_details.php" method="post">
							<input style="display: none;" type="text" name="goods_id" value="<?php echo $goods_id; ?>" />
							<input id="bt_submit" type="submit" value=""/>
						</form>
						<img class="good01_img" src="../img/system/goods/<?php echo $img_pathi; ?>"/>
						<div class="good01_title">
							<span id="name"><?php echo $goods_namei; ?></span>
							<!--<span id="money01">￥:3000.00</span>-->
							<span id="money02">￥<?php echo $goods_moneyi; ?>.00</span>
						</div>
					</div>
					<?php
						}
					?>
				</div>
				<!--分页-->
				<div class="page">
					<center>
					<div class="pages">
						<!--<a href="#"><</a>-->
						<a href="?pageNum=<?php echo $pageNum==1?1:($pageNum-1)?>"><</a>	
						<?php
							for($i=1;$i<=$endPage;$i++){
							echo '&nbsp;';//页码序号前间距
							echo "<a href='?pageNum=$i'>$i</a>";
							echo '&nbsp;';//页码序号后间距
							}
						?>
						<!--<a href="?pageNum=<?php echo $endPage?>"><?php echo $endPage; ?></a>-->
						<a href="?pageNum=<?php echo $pageNum==$endPage?$endPage:($pageNum+1)?>">></a>	
					</div>
					</center>
				</div>
				<!--底部-->
				<div class="footer">
					<div class="one">
						<span class="buy">购物指南</span>
						<span>购买流程</span>
						<span>常见问题</span>
						<span>联系客服</span>
						<span>物品发布</span>
						<span>发布问题</span>
					</div>
					<div class="one">
						<span class="buy">配送方式</span>
						<span>上门自提</span>
						<span>快递配送</span>
						<span>送货上门</span>
					</div>
					<div class="one">
						<span class="buy">支付方式</span>
						<span>在线支付</span>
						<span>货到付款</span>
						<span>分期付款</span>
					</div>
					<div class="one">
						<span class="buy">售后服务</span>
						<span>售后政策</span>
						<span>退款说明</span>
						<span>取消订单</span>
					</div>
				</div>
				<div class="footer02">
					<ul>
						<li>关于我们&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>联系我们&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>诚招英才&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>论坛&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>友情链接&nbsp;&nbsp;&nbsp;&nbsp;</li>
						<li>相关产品</li>
					</ul>
				</div>
				<div class="footer02_about">
					<hr />
					<ul>
						<li>用户协议&nbsp;&nbsp;|&nbsp;&nbsp;</li>
						<li>隐藏协议&nbsp;&nbsp;|&nbsp;&nbsp;</li>
						<li>Copyright © 2019  易置开发团队版权所有</li>
					</ul>
				</div>
			</div>
		</div>
	<script src="../js/jquery-3.4.1.js"></script>
    <script src="../js/goods_all.js"></script>
	</body>
</html>